<extend name="Base/agent"/>
<block name="content">	
			
			<!--主体内容-->
			<div class="admin-main">
				<p class="current-title">设置</p>
				<p class="current-park"><i class="icon icon-index"></i><a href="#" class="current-index">首页</a> 〉〉 设置</p>
				
				<!--数据表格-->
				<form action = "{:U('AgentSet/pwd_change')}" method = "POST" id = "pwd_change">
				<div class="main-table-data">
					<p class="table-title">修改密码</p>
					<div class="main-update-pwd">
						<p><span class="tag-newpwd"><font class="icon-mark">※</font>原密码</span>
							<input type="password" class="current-newpwd" name = "before_pwd" id = "before_pwd"/>
						</p>
						<p><span class="tag-newpwd"><font class="icon-mark">※</font>新密码</span>
							<input type="password" class="current-newpwd" name = "new_pwd" id = "new_pwd"/>
						</p>
						<p><span class="tag-newpwd"><font class="icon-mark">※</font>确认密码</span>
							<input type="password" class="current-newpwd" name = "confirm" id = "confirm"/>
						</p>
					</div>
					<p style = "margin-left:150px;margin-top:10px;color:red" id = "error"></p>
					<input type="hidden" value = "{:session('AGENT.user_id')}" id = "id"/>
					<input type="button" class="current-newpwd current-pwd-sub" value = "保存" style = "border:0px" id = "button"/>
				</div>
				</form>
			</div>

		</div>
	</body>
	<script src="js/datepicker/js/jquery-1.8.3.js"></script>
	<script src="js/datepicker/js/jquery.ui.core.js"></script>
	<script src="js/datepicker/js/jquery.ui.widget.js"></script>
	<script src="js/datepicker/js/jquery.ui.datepicker.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$(".subNav").click(function(){
                $(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
                $(this).next(".navContent").slideToggle().siblings(".navContent").slideUp();
            })
			

			$( ".current-stardate,.current-enddate" ).datepicker({ dateFormat: 'yy-mm-dd' }).val();
			
		});
		$('#button').click(function(){
			var new_pwd = $('#new_pwd').val();
			var before_pwd = $('#before_pwd').val();
			var confirm = $('#confirm').val();
			var id = $('#id').val();
			if(new_pwd != confirm){
				$('#error').html('两次输入的内容不一致');
			}else{
				$.post("{:U('AgentSet/pwd_change')}",{before_pwd:before_pwd,new_pwd:new_pwd,confirm:confirm,id:id},error,"json");
				function error(data){
					if(data.status != 0){
						alert(data.info);
						location.href = "{:U('AgentPublic/login')}";
					}else{
						$("#error").html(data.info);
					}
				}
			}
			
		})
	</script>
</block>